Number of Original Surviving Ramones


In [3]:
columns = ['Dee Dee', 'Johnny', 'Joey', 'Tommy', 'Marky']

birth_years = [1951, 1948, 1951, 1951, 1956]
death_years = [2002, 2004, 2001, None, None]

In [4]:
import datetime
from pandas import Series
from pandas import DataFrame
from pandas import date_range

todays_date = datetime.datetime.now().date()
index = date_range('1/1/1948', periods=66, freq='A')

d = {}
for i, ramone in enumerate(columns):
    if death_years[i]:
        years = death_years[i] - birth_years[i] + 1
    else:
        years = 2013 - birth_years[i] + 1
    years_alive = date_range('1/1/%i' % birth_years[i], periods=years, freq='A')
    series = Series(1, index=years_alive)
    d[ramone] = series
    
df = DataFrame(d, index=index)

df


Out[4]:
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 66 entries, 1948-12-31 00:00:00 to 2013-12-31 00:00:00
Freq: A-DEC
Data columns (total 5 columns):
Dee Dee    52  non-null values
Joey       51  non-null values
Johnny     57  non-null values
Marky      58  non-null values
Tommy      63  non-null values
dtypes: float64(5)

In [5]:
import vincent
vincent.core.initialize_notebook()

stacked = vincent.StackedArea(df)
stacked.axis_titles(x='Year', y='Total Ramones')
stacked.legend(title='Ramones')
stacked.colors(brew='Spectral')
stacked.width=600
stacked.height=400
stacked.display()



In [5]: